package com.zhijian.medical.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.zhijian.medical.dao.local.RoutineSingleSampleYzMapper;
import com.zhijian.medical.entity.po.RoutineSingleSampleYz;
import com.zhijian.medical.entity.vo.request.RoutineSingleSampleYzSearchVo;
import com.zhijian.medical.entity.vo.response.RoutineSingleSampleYzVo;
import com.zhijian.util.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RoutineSingleSampleYzService extends ServiceImpl<RoutineSingleSampleYzMapper, RoutineSingleSampleYz> implements IService<RoutineSingleSampleYz> {

    @Autowired
    private RoutineSingleSampleYzMapper routineSingleSampleYzMapper;

    public Page<RoutineSingleSampleYzVo> selectPage(RoutineSingleSampleYzSearchVo singleSampleYzSearchVo){
        PageHelper.startPage(singleSampleYzSearchVo.getPageNum(), singleSampleYzSearchVo.getPageSize());
        com.github.pagehelper.Page<RoutineSingleSampleYzVo> orgData = routineSingleSampleYzMapper.selectList(singleSampleYzSearchVo);
        Page<RoutineSingleSampleYzVo> dataList =
                new com.zhijian.util.page.Page<>(true, Integer.parseInt( String.valueOf(orgData.getTotal())), singleSampleYzSearchVo.getPageNum(), singleSampleYzSearchVo.getPageSize());
        dataList.setData(orgData);
        return dataList;
    }
}
